﻿/*****************************************************************//**
 * @file    FITKGraphObjectInteractionSurfToSurfExplicit.h
 * @brief   Graph object for 'surface to surface explicit' interactions.
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-05-06
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTINTERACTIONSURFTOSURFEXPLICIT_H__
#define __FITKGRAPHOBJECTINTERACTIONSURFTOSURFEXPLICIT_H__

#include "FITKGraphObjectInteractionBase.h"

#include "FITKVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkPoints;
class vtkCellArray;
class vtkDoubleArray;
class vtkPolyData;
class vtkArrowSource;

namespace Interface
{
    class FITKAbaInteractionSurfToSurfExplicit;
}

namespace Exchange
{
    /**
     * @brief   Graph object for 'surface to surface explicit' interactions.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-05-06
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectInteractionSurfToSurfExplicit : public FITKGraphObjectInteractionBase
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectInteractionSurfToSurfExplicit, FITKGraphObjectInteractionBase);
        FITKCLASS(Exchange, FITKGraphObjectInteractionSurfToSurfExplicit);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   surfToSurfExpData: The surface to surface explicit interactions data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-06
         */
        FITKGraphObjectInteractionSurfToSurfExplicit(AbaqusData::FITKDataCase* caseData, Interface::FITKAbaInteractionSurfToSurfExplicit* surfToSurfExpData);

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-06
         */
        ~FITKGraphObjectInteractionSurfToSurfExplicit();

        /**
         * @brief   Show or hide graph object.[override]
         * @param   visibility: The visibility of graph object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-10-17
         */
        void setVisible(bool visibility) override;

        /**
         * @brief   Highlight the surface to surface graph actors.[override]
         * @param   color: The given color for highlighting this time[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-06
         */
        void highlight(QColor color = QColor()) override;

        /**
         * @brief   Dis-highlight the interactions or constraint graph actors.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        void disHighlight() override;

        /**
         * @brief   Update the visibility with data object's visibility.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        void updateVisibility() override;

        /**
         * @brief   Simplified the graph object if necessary.[override]
         * @param   enabled: Enabled simplified flag
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-20
         */
        void simplified(bool enabled) override;

    private:
        /**
         * @brief   Initialize.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-06
         */
        void init() override;

        /**
         * @brief   Generate the poly data for the interactions.[override]
         * @param   interactions: The interactions data object
         * @return  Is OK
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-06
         */
        bool generatePolyData(Interface::FITKInteractionLocation* interactions) override;

        /**
         * @brief   Generate interactions actor.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-06
         */
        void generateGraph() override;

        /**
         * @brief   Initialize the actors.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        void initActors() override;

        /**
         * @brief   Clear the model ids and the visibility hash.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        void clearModelsInfo() override;

        /**
         * @brief   Clear the data.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        void clearData() override;

    private:
        /**
         * @brief   The graph actor for location two's glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-26
         */
        FITKGraphActor* m_fActor_2{ nullptr };

        /**
         * @brief   The points data for location two's glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkPoints* m_points_2{ nullptr };

        /**
         * @brief   The model id data array for location two's glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkIntArray* m_modelIdArray_2{ nullptr };

        /**
         * @brief   The grid data for location two's glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkUnstructuredGrid* m_ugrid_2{ nullptr };

        /**
         * @brief   The selection node for extract mesh grid for location two's component.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkSelectionNode* m_selectNode_2{ nullptr };

        /**
         * @brief   The selection for vtkSelectionNode for location two's component.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkSelection* m_section_2{ nullptr };

        /**
         * @brief   The mesh grid extractor for location two's component.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkExtractSelection* m_extractSelection_2{ nullptr };

        /**
         * @brief   The indice array of extract id for location two's component.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkIdTypeArray* m_idArray_2{ nullptr };

        /**
         * @brief   Is the location one's component a shell's surface.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        bool m_isShellSurfaceLoc_1 = false;

        /**
         * @brief   Is the location two's component a shell's surface.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        bool m_isShellSurfaceLoc_2 = false;

        /**
         * @brief   The arrow source for highlighting the surface's tie glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkArrowSource* m_surfaceSource{ nullptr };

        /**
         * @brief   The glyph 3D for location one.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkGlyph3D* m_glyph{ nullptr };

        /**
         * @brief   The glyph 3D for location two.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkGlyph3D* m_glyph_2{ nullptr };

//#ifdef QT_NO_DEBUG
        /**
         * @brief   The distance to camera filter for location one.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkDistanceToCamera* m_distanceToCamera{ nullptr };

        /**
         * @brief   The distance to camera filter for location two.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkDistanceToCamera* m_distanceToCamera_2{ nullptr };
//#endif

        /**
         * @brief   The normal data for location one's component.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkDoubleArray* m_normal{ nullptr };

        /**
         * @brief   The normal data for location two's component.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-18
         */
        vtkDoubleArray* m_normal_2{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTINTERACTIONSURFTOSURFEXPLICIT_H__
